﻿using System;
using SharpSqlAnalyzer.nodes;

namespace SharpSqlAnalyzer.stmt
{
	// Token: 0x02000097 RID: 151
	public class TCreateSchemaSqlStatement : TCustomSqlStatement
	{
		// Token: 0x06000451 RID: 1105 RVA: 0x002FB249 File Offset: 0x002F9449
		public TCreateSchemaSqlStatement(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstmssqlcreateschema;
		}

		// Token: 0x06000452 RID: 1106 RVA: 0x002FB25D File Offset: 0x002F945D
		internal override void buildsql()
		{
		}

		// Token: 0x06000453 RID: 1107 RVA: 0x002FB25F File Offset: 0x002F945F
		internal override void clear()
		{
		}

		// Token: 0x06000454 RID: 1108 RVA: 0x002FB261 File Offset: 0x002F9461
		internal override string getasprettytext()
		{
			return "";
		}

		// Token: 0x06000455 RID: 1109 RVA: 0x002FB268 File Offset: 0x002F9468
		internal virtual void iterate(TVisitorAbs pvisitor)
		{
		}

		// Token: 0x17000090 RID: 144
		// (get) Token: 0x06000456 RID: 1110 RVA: 0x002FB26A File Offset: 0x002F946A
		// (set) Token: 0x06000457 RID: 1111 RVA: 0x002FB272 File Offset: 0x002F9472
		public TObjectName SchemaName
		{
			get
			{
				return this._schemaName;
			}
			set
			{
				this._schemaName = value;
			}
		}

		// Token: 0x17000091 RID: 145
		// (get) Token: 0x06000458 RID: 1112 RVA: 0x002FB27B File Offset: 0x002F947B
		// (set) Token: 0x06000459 RID: 1113 RVA: 0x002FB283 File Offset: 0x002F9483
		public TObjectName OwnerName
		{
			get
			{
				return this._ownerName;
			}
			set
			{
				this._ownerName = value;
			}
		}

		// Token: 0x0600045A RID: 1114 RVA: 0x002FB28C File Offset: 0x002F948C
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			EDbVendor dbvendor = this.dbvendor;
			if (dbvendor <= EDbVendor.dbvpostgresql)
			{
				if (dbvendor == EDbVendor.dbvmssql || dbvendor == EDbVendor.dbvpostgresql)
				{
					TCreateSchemaSqlNode tcreateSchemaSqlNode = (TCreateSchemaSqlNode)this.rootNode;
					this._schemaName = tcreateSchemaSqlNode.schemaName;
					this._ownerName = tcreateSchemaSqlNode.ownerName;
					if (tcreateSchemaSqlNode.statementListSqlNode != null)
					{
						tcreateSchemaSqlNode.statementListSqlNode.doParse(this, ESqlClause.unknown);
						for (int i = 0; i < tcreateSchemaSqlNode.statementListSqlNode.size(); i++)
						{
							this.Statements.add(tcreateSchemaSqlNode.statementListSqlNode.getStatementSqlNode(i).Stmt);
						}
					}
					base.DatabaseObjects.Add(this.SchemaName);
				}
			}
			else if (dbvendor == EDbVendor.dbvsnowflake || dbvendor == EDbVendor.dbvhana)
			{
				TDummy tdummy = (TDummy)this.rootNode;
				this._schemaName = (TObjectName)tdummy.node1;
			}
			return 0;
		}

		// Token: 0x0600045B RID: 1115 RVA: 0x002FB36F File Offset: 0x002F956F
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x0600045C RID: 1116 RVA: 0x002FB37F File Offset: 0x002F957F
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x040010EE RID: 4334
		private TObjectName _schemaName;

		// Token: 0x040010EF RID: 4335
		private TObjectName _ownerName;

		// Token: 0x040010F0 RID: 4336
		private TStatementListSqlNode _statementListSqlNode;
	}
}
